package com.mediatek.contacts.ext;

import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Intent;
import android.content.Context;
import android.net.Uri;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;

import com.android.contacts.common.model.RawContact;
import com.android.contacts.common.model.RawContactDelta;
import com.google.common.collect.ImmutableList;

public class DefaultRcsExtension implements IRcsExtension {       
    //-----------------------------for Multi Choise------------------//
    /**
     * OP01 RCS will filter phone number in phone Multi Choise list.
     * let the op01 get intent data from host set.
     * @param intent data from caller
     */
    @Override
    public void getIntentData(Intent intent) {
        //do-nothing    
    }

    /**
     * OP01 RCS will filter phone number in phone Multi Choise list.
     * set the exist numbers for filter,not show in list.
     * @param query selection 
     */
    @Override
    public void setListFilter(StringBuilder selection) {
        //do-nothing
    }

    /**
     * OP01 RCS will config phone Multi Choise list Uri.
     * remove duplicate number in list.
     * @param query uri 
     */
    @Override
    public Uri configListUri(Uri uri) {
        return uri;
    }

    /**
     * OP01 RCS will add menu item in phone Multi Choise list, eg:group.
     * mark item for selected group in phone numbers list.
     * @param list menu and list context 
     */
    @Override
    public void addListMenuOptions(Context context, Menu menu) {
        //do-nothing
    }

    /**
     * OP01 RCS will mark item for selected group in phone numbers list.
     * get data ids from selected group and mark item in list.
     * @param list fragment and data ids 
     */
    @Override
    public void getGroupListResult(Fragment fragment, long[] ids) {
        //do-nothing    
    }

    /**
     * OP01 RCS custom search button in action bar.
     * search button is invisible in phone numbers list.
     * @param search menu item 
     */
    @Override
    public void customSearchInActionBar(MenuItem item) {
        //do-nothing      
    }

    //-----------------------------for group------------------//
    /**
     * OP01 RCS will add group menu item
     * custom group menu and show in action bar.
     * @param menu: group menu
     * @param context: group activity context
     */
    @Override
    public void addGroupMenuOptions(Menu menu, Context context) {
        //do-nothing
    }

     //-----------------------------for editor------------------//
     /**
     * OP01 RCS will listen phone number text change.
     * if query same phone number, show popup list view for choose.
     * @param editor view ,state and input content
     */
    @Override
    public void setTextChangedListener(RawContactDelta state, EditText view, int inputType, String number) {
        //do-nothing    
    }

     /**
     * OP01 RCS will close listener of phone number text change.
     * close list popup and destroy search engine.
     * @param true:quit search engine, false:only close popup popup list
     */
    @Override
    public void closeTextChangedListener(boolean quit) {
        //do-nothing 
    }

    /**
     * OP01 RCS will set currnet editor fragment and it's manager.
     * @param editor fagment and fagment manager
     */
    @Override
    public void setEditorFragment(Fragment fragment, FragmentManager manager) {
        //do-nothing 
    }

    //--------------for PeopleActivity----------------//
    /**
     * OP01 RCS will add menu item in PeopleActivity
     * @param people menu
     */
    @Override
    public void addPeopleMenuOptions(Menu menu) {
        //do-nothing
    }

    /**
     * OP01 RCS will go to personal profile activity, once clicked profile item.
     * @param uri. contact lookup uri.
     * @param isEmpty. is current profile is empty.
     * @return 1: is profile, and listentenr set sucess. 0. listener set unsucessful
     */
    @Override
    public boolean addRcsProfileEntryListener(Uri uri, boolean isEmpty) {
        return false;
    }

    /**
     * OP01 RCS will add public account entry to people list.
     * @param context. context of the activity
     * @param listView. list view of contact info
     */
    @Override
    public void createPublicAccountEntryView(ListView listView) {
        //do-nothing
    }

    //--------------for QuickContact----------------//
    /**
     * OP01 RCS will go to contact detail activity, update photo from rcs server.
     * @param lookupUri. contact lookup uri.
     * @param photo. Contact photoView.
     */
    @Override
    public void updateContactPhotoFromRcsServer(Uri lookupUri, ImageView photo, Context context) {
         //do-nothing   
    }

    /**
     * OP01 RCS remove rich communication Suite account.
     * @param rawContacts. original rawContacts list.
     * @return cofigured rawContacts list.
     */
    @Override
    public ImmutableList<RawContact> rcsConfigureRawContacts(ImmutableList<RawContact> rawContacts) {
        return rawContacts;
    }

    /**
     * OP01 RCS will get photo from rcs server, and refresh thumbnail Photo.
     * @param isLetterTile. Letter photo or thumbnail Photo.
     * @param hasThemeColor. Theme Color has set or not.
     * @return true or false.
     */
    @Override
    public boolean needUpdateContactPhoto(boolean isLetterTile, boolean hasThemeColor) {
        //do-nothing, just return hasThemeColor default value. 
        return hasThemeColor;
    }

    @Override
    public ContactListItemRcsView getContactListItemRcsView() {
        return mContactListItemRcsView;
    }

    @Override
    public QuickContactRcsScroller getQuickContactRcsScroller() {
        return mQuickContactScrollerCustom;
    }

    /////------------------below are the default implements------------------//
    private ContactListItemRcsView mContactListItemRcsView = new ContactListItemRcsView() {

        @Override
        public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
            // do-nothing
        }

        @Override
        public void onLayout(boolean changed, int leftBound, int topBound, int rightBound,
                int bottomBound) {
            // do-nothing
        }

        @Override
        public View createCustomView(long contactId) {
            return null;
        }
    };

    private QuickContactRcsScroller mQuickContactScrollerCustom = new QuickContactRcsScroller() {
        @Override
        public View createRcsIconView(View container, View anchorView, Uri lookupUri) {
            return null;
        }

        @Override
        public void updateRcsContact(Uri lookupUri) {
            // do-nothing
        }

        @Override
        public void updateRcsIconView() {
            // do-nothing
        }
    };
}
